package com.dbh.company.buildbook;

import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.FFmpegFrameRecorder;
import org.bytedeco.javacv.Frame;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

/**
 * @author dongbanghui
 * @create 2024/3/11
 */
public class Video {

    public static void recordPageVideo(String url, String outputFilePath, int recordTime) throws Exception {

        // 创建ffmpeg进程
        ProcessBuilder pb = new ProcessBuilder(
                "ffmpeg",
                "-y",
                "-f", "image2pipe",
                "-r", "30",
                "-i", "-",
                "-c:v", "libx264",
                "-pix_fmt", "yuv420p",
                "output.mp4"
        );
        pb.start();
    }

    public static void main(String[] args) throws Exception {
        String url = "http://reds-mr-server.loushu-test1.ttb.test.ke.com/resblock/backend/673767?noui=1";
        recordPageVideo(url, "D:\\data\\work\\output.mp4", 6);
    }

}
